<!-- Author:Rain -->
<template>
    <div id="grandson">
        <h1>这里是子组件</h1>
        {{ user }}
        <grandson></grandson>
    </div>
</template>

<script setup lang="ts">
import {inject,provide} from "vue"
import grandson from './grandson.vue';
import { CurUserKey,AuthUserKey } from "@/constants/injection-key.ts"

provide(CurUserKey,{name:'小柔'})//这里的话就出现了注入名冲突的情况！！！，中间层也用User
const user=inject(AuthUserKey)


</script>

<style scoped>
#grandson{
    padding: 30px;
    background-color: rgb(165, 116, 217);
}
</style>